package serveur;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@SuppressWarnings("serial")
public class Tweet implements Serializable {

	protected String topic;
	protected String message;
	protected String pseudo;
	protected Date date;

	public Tweet(String topic, String message, String pseudo) {
		super();
		this.topic = topic;
		this.message = message;
		this.pseudo = pseudo;
		this.date = new Date();
	}

	public String getTopic() {
		return topic;
	}

	public void setTopic(String topic) {
		this.topic = topic;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	public List<Object> displayTweet() {
		List<Object> l = new ArrayList<Object>();
		
		String sDate, sRetour;

		sDate = Integer.toString(date.getDay()) + "/" + date.getMonth() + "/"
				+ Integer.toString(date.getYear() + 1900);
		sRetour = "#" + this.topic + "\n" + sDate + " par " + this.pseudo + "\n\t"
				+ this.message + "\n\n";
		l.add(sRetour);
		
		return l;
	}

	@Override
	public String toString() {
		String sDate, sRetour;
		String barre = "--------------------\n";

		sDate = Integer.toString(date.getDay()) + "/" + date.getMonth() + "/"
				+ Integer.toString(date.getYear() + 1900);
		sRetour = "#" + this.topic + "\n" + sDate + " par " + this.pseudo + "\n\t"
				+ this.message + "\n\n";

		return sRetour;
	}

}
